From: Stefan Monnier Date: Tue, 12 Dec 2006 02:36:38 +0000 (+0000) Subject: (syntax-ppss-toplevel-pos): New fun. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~31537 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=0e6c966c96290f53f281016c6e40c7404daf759b;p=emacs.git (syntax-ppss-toplevel-pos): New fun. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0b5cdc4a2fe..a75bfaf9191 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2006-12-12 Stefan Monnier + + * emacs-lisp/syntax.el (syntax-ppss-toplevel-pos): New fun. + 2006-12-11 Juanma Barranquero * subr.el (unread-command-char): Reformat obsolescence info. diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 695d7877b38..f290db42c04 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -52,6 +52,14 @@ (defsubst syntax-ppss-depth (ppss) (nth 0 ppss)) +(defun syntax-ppss-toplevel-pos (ppss) + "Return the last preceding position at toplevel. +\"At toplevel\" means that it is outside of any syntactic entity: +outside of any parentheses, or comments, or strings. +Returns nil iff PPSS itself corresponds to a toplevel position." + (or (car (nth 9 ppss)) + (nth 8 ppss))) + (defsubst syntax-ppss-context (ppss) (cond ((nth 3 ppss) 'string)